package com.rgz.util;

import java.util.List;

public class PageUtil<T> {
    private Integer pageNo;
    private Integer pageSize;
    private Integer rows;
    private Integer pageTotal;
    private List<T> list;
    
    
    
	public PageUtil(Integer pageNo, Integer pageSize, Integer rows) {
		this.pageSize = pageSize;
		this.rows = rows;
		this.pageTotal=this.rows%this.pageSize==0?
				this.rows/this.pageSize:(this.rows/this.pageSize)+1;
		if (pageNo==null||pageNo<1||this.pageTotal==0) {
			this.pageNo=1;
		} else if(pageNo>this.pageTotal){
            this.pageNo=this.pageTotal;
		}else{
			this.pageNo=pageNo;
		}
		
	}
	public Integer getPageNo() {
		return pageNo;
	}
	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public Integer getRows() {
		return rows;
	}
	public void setRows(Integer rows) {
		this.rows = rows;
	}
	public Integer getPageTotal() {
		return pageTotal;
	}
	public void setPageTotal(Integer pageTotal) {
		this.pageTotal = pageTotal;
	}
	public List<T> getList() {
		return list;
	}
	public void setList(List<T> list) {
		this.list = list;
	}
	
	
	
}
